package java6681.analysis;

import java.util.Scanner;

public class SwapUpLower6681 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入字符串：");
        String line = sc.nextLine();
        String s = swap6681(line);
        System.out.println("大小写交换：");
        System.out.println(s);
    }
    public static String swap6681(String s){
        String sb = "";
        for (int i = 0; i < s.length(); i++) {
            char ch = s.charAt(i);
            if (ch >= 'A' && ch <= 'Z'){
                 sb += String.valueOf(ch).toLowerCase();
            }else if (ch >= 'a' && ch <= 'z'){
                sb += String.valueOf(ch).toUpperCase();
            }else{
                sb += s.charAt(i);
            }
        }
        if (s.length() == 0){
            sb ="";
        }
       return sb;
    }
}
